/**
 * layui.table表格加载图片工具，按16:9显示
 * @type {{load, style}}
 */
var imageUtil = (function () {
    return {
        load: function (src) {
            var image = document.createElement("img");
            image.className = 'user-defined-images';

            // 默认图片
            var defaultImages = 'http://i2.tiimg.com/675940/40562e8f48768848.jpg';
            image.src = src || defaultImages;

            var container = document.createElement("div");
            container.className = 'img-container';
            container.appendChild(image); // 为div输入内容

            var div = document.createElement("div");
            div.appendChild(container);
            //console.log(div.innerHTML);
            return "<div>" + div.innerHTML + "</div>";
        },
        style: function () {
            $('.layui-table-cell').css('cssText',"height:auto!important;");
            $('.img-container').css({"padding-bottom":"56%","width":"100%","position":"relative"});
            $('.layui-table .user-defined-images').css('cssText',"max-width:100%!important");
            $('.layui-table .user-defined-images').css({"width": "100%", "height": "100%", "position": "absolute", "top": "0", "left": "0"});
            $('.layui-table-view .layui-table td').css('cssText',"cursor:pointer!important");// 鼠标显示为手势
        }
    }
})();